package com.learn.order.config;

import com.learn.order.service.OrderService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@RabbitListener(queues = "orderDelayQueue")
public class OrderDelayConsumer {
    @Resource
    private OrderService orderService;

    @RabbitListener
    public void process(String orderId) {
        // 取消订单
        orderService.cancelOrder(orderId);
    }
}
